<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="{{url_for('static',filename='js/jquery.min.js')}}"></script>
    <script src="{{url_for('static',filename='js/alert.js')}}"></script>
    <script src="{{url_for('static',filename='js/manualOperationAccountInfo.js')}}?{{ version }}"></script>

    <script src="{{url_for('static',filename='js/manualOperationEntrustInfo.js')}}?{{ version }}"></script>

    <script src="{{url_for('static',filename='js/clientInfo.js')}}"></script>

    <script src="{{url_for('static',filename='js/bootstrap.min.js')}}"></script>
    <script src="{{url_for('static',filename='js/jquery.dataTables.min.js')}}"></script>
    <link rel="stylesheet" href="{{url_for('static',filename='css/jquery.dataTables.min.css')}}">
    <link rel="stylesheet" href="{{url_for('static',filename='css/bootstrap.min.css')}}">
    <style>
    .button{
        background-color: white;
        color: black;
        border: 2px solid #4CAF50;
    }

    .button:hover {
        background-color: #4CAF50;
        color: white;
    }
    .button[disabled] {
        opacity: 0.6;
        cursor: not-allowed;
    }

    </style>

    <title>人工操作</title>

</head>
<body>
        <nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
    <div class="navbar-header">
        <a class="navbar-brand" href="#">盯盘宝后台管理系统</a>
    </div>
    <div>
        <ul class="nav navbar-nav">
            <li ><a href="{{ url_for('start_web') }}">首页</a></li>
            <li ><a href="{{ url_for('permission_manage') }}">权限配置</a></li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    管理员{{ session['admin'] if session['admin'] else "未登录" }}
                    <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="{{ url_for("login_out") }}">退出</a></li>
                </ul>
            </li>
        </ul>
    </div>
    </div>
</nav>
<div id="all_content" style="margin:auto; width:80%">

<div class="container-fluid">
	<div class="row-fluid">
		<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
			<h3 class="text-center">
				交易总开关
			</h3>
			<div class="row-fluid">
				<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
					 <button class="btn btn-block btn-primary" onclick="buyOpen()">开启</button>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
					 <button class="btn btn-block btn-primary" onclick="buyOff()">关闭</button>
				</div>
			</div>
		</div>
	</div>
</div>
<br/>
<br/>
    <div id = "configure_account" style="display:None;" class="row">
        <div class="row" align="center">
<div class="btn-group btn-group-lg" role="group" aria-label="...">
        <div class="btn-group" >
          <button id="source-button" type="button" class="btn btn-primary">全部</button>
          <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <span class="caret"></span>
            <span class="sr-only">Toggle Dropdown</span>
          </button>
          <ul class="dropdown-menu">
            <li><a href="#" onclick="selectSource('全部')">全部</a></li>
            <li><a href="#" onclick="selectSource('试用用户')">试用用户</a></li>
            <li><a href="#" onclick="selectSource('正式用户')">正式用户</a></li>
          </ul>
    </div>

    <div class="btn-group" role="group">
    <button type="button" class="btn btn-primary" onclick="cancel_configure_account()">隐藏配置/持仓</button>
    </div>

</div>
</div>
        <h3 align="center">当日买入股票21:00后才能配置</h3>
 <br/>
<table id="configureAccountDataTable" cellspacing="0" style="border: 1px solid rgb(68,113,188)" border="1"  width="80%">
        <thead>
        <tr>
            <th rowspan="2">用户名</th>
            <th rowspan="2">账户</th>
            <th rowspan="2">用户类型</th>
            <th rowspan="2">买入策略</th>
            <th rowspan="2">股票</th>
            <th rowspan="2">可卖数量</th>
            <th rowspan="2">人工卖出数量</th>
            <th>市值</th>
            <th rowspan="2">修改人工卖出数量</th>
        </tr>
        <th id="market_value_sum">市值总和:0</th>
        </thead>
</table>

</div>

    <br/><br/>
<div class="row" align="center">
<div class="btn-group btn-group-lg" role="group" aria-label="...">
    <div class="btn-group" role="group">
    <button id ="adapter" type="button" class="btn btn-default" onclick="changeDisplay('adapter')">实盘账户</button>
    </div>

    <div class="btn-group" role="group">
    <button id ="db" type="button" class="btn btn-default" onclick="changeDisplay('db')">备用</button>
    </div>
</div>
</div>
    <h3 align="center">风险等级</h3>
    <div class="row" align="center">
<div class="btn-group btn-group-lg" role="group" aria-label="...">
    <div class="btn-group" role="group">
    <button id ="risk-low" type="button" class="btn btn-default" onclick="changeRiskDisplay('risk-low')">低</button>
    </div>

    <div class="btn-group" role="group">
    <button id ="risk-high" type="button" class="btn btn-default" onclick="changeRiskDisplay('risk-high')">高</button>
    </div>
</div>
</div>

<!--账户持仓   -->
<div id="account_info">
    <h3 align="center">当日买入股票21:00后才能切人工</h3>
    <h3>待卖股票</h3>
    <div style="margin:auto">
    <div id="dataTable" class="table table-striped table-bordered" cellspacing="0" width="80%">
    </div>
    </div>
</div>

    <div id="to_buy_stocks">
    <h3>待买股票</h3>
        <div style="margin:auto">
<div id="add-block" align="center">
<div style="width:30%;">
 <div class="input-group">
     <input type="text" class="form-control" id="stock-input" />
     <span class="input-group-addon"><a href="#" onclick="addStock()"><i class="glyphicon glyphicon-plus"> <span>添加(请输入中文名或6位代码)</span></i></a></span>
 </div>
</div>
</div>
</div>
            <br/><br/>
    <table id="toBuyStocksDataTable" cellspacing="0" style="border: 1px solid " border="1"  width="100%">
        <thead>
        <tr>
            <th>证券代码</th>
            <th>证券名称</th>
            <th>当前价</th>
            <th>已买仓位</th>
            <th>仓位选择</th>
            <th>市价买入</th>
            <th>限价买入</th>
            <th>删除</th>
        </tr>
        </thead>
    </table>
    </div>

<!--今日委托-->
<div id="entrust_info">
    <h3>人工买卖委托</h3>

    <div style="margin:auto">

    <div id="entrustDataTable" class="table table-striped table-bordered" cellspacing="0" width="80%">
    </div>
    </div>


</div>
<!--今日委托-->

<!--客户列表-->
<div id="client_info">
    <h3>客户列表</h3>

    <div style="margin:auto">
    <div class="input-group col-xs-12">
    <select id="client_date" class="form-control" style="margin:0px 20px 0px 0px;width:auto;">
    <option value = "全部">全部</option>
    </select>
    <select id = "client_account_id" class="form-control" style="margin:0px 0px 0px 20px;width:auto;">
    </select>

    </select>
    <select id = "client_profit_loss" class="form-control" style="margin:0px 0px 0px 20px;width:auto;">
    <option value = "全部">全部</option>
    <option value = "盈利">盈利</option>
    <option value = "亏损">亏损</option>

    </select>
    </div>
    <br/>
    <br/>

    <div id="clientInfoDataTable" class="table table-striped table-bordered" cellspacing="0" width="80%">
    </div>
    </div>


</div>
<!--客户列表-->

</div>


<script type="text/javascript">
function doBuy(code,name,buyPrice) {
    if ($("#"+code+"_radio1").is(':checked')){
        var position = 2;
    }else if ($("#"+code+"_radio2").is(':checked')){
        var position = 3;
    }else if ($("#"+code+"_radio2").is(':checked')){
        var position = 6;
    }else{
        alert("请选择仓位!");
        return;
    }
	$.ajax({
			url:'/buyStock',
			async:true,
			type:'POST',
			data:JSON.stringify({'code':code,'name':name,'buy_price':buyPrice,'position':position}),
			dataType:'json',
			success:function(result){
				var obj = result;
				if (obj.message){
					alert(obj.message);
					refreshToBuyStocks();
				}
		}
	  });
}
function addStock() {
    var stock = $("#stock-input").val();
    if (stock== ""){
        alert("请输入股票");
        return;
    }
    $.ajax({
    url: "/addStockForManualSell",
    async: true,
    type: 'POST',
    data: JSON.stringify({'type':'add','stock': stock}),
    dataType: 'json',
    success: function (result) {
        var message = result.message;
        alert(message);
        refreshToBuyStocks();
    }
    });
}
function del_code(code) {
    var go=window.confirm("您确定要删除股票 "+code+" 吗?");
	if (go==false){
		return;
	}
    $.ajax({
    url: "/addStockForManualSell",
    async: true,
    type: 'POST',
    data: JSON.stringify({'type':'del','stock': code}),
    dataType: 'json',
    success: function (result) {
        var message = result.message;
        alert(message);
        refreshToBuyStocks();
    }
    });
}
function market_price_buy(code,name){
	var go=window.confirm("您确定要按市价买入 "+code+" 吗?");
	if (go==false){
		return;
	}
	var buyPrice = 0.0;
	doBuy(code,name,buyPrice);
}

function limit_price_buy(code,name){
	var buyPrice = $("#"+code+"_buy").val();
	if (buyPrice == null | buyPrice == '' | buyPrice == undefined){
		alert("请输入价格!");
		return;
	}
	var go=window.confirm("您确定要按价格 "+buyPrice+" 买入股票 "+code+" 吗?");
	if (go==false){
		return;
	}
	$("#"+code+"_buy").val('');
    buyPrice = parseFloat(buyPrice);
    doBuy(code,name,buyPrice);
}


    function update_manual_sell_vol(type,code,strategy,account_id,sell_vol) {
        $.ajax({
            url:"updateManualSell",
            type:"POST",
            data:JSON.stringify({"type":type,"code":code,"strategy":strategy,"account_id":account_id,"sell_vol":sell_vol}),
            success:function (result) {
                configure_account(code,true);
                selectSource($("#source-button").text());
            }
        });
    }
    function selectSource(type) {
        $("#source-button").text(type);
             if (type == "全部"){
                 type = "";
        }
        configureAccountDataTable.column(2).search(type).draw();
    }
        var configureAccountDataTable = null;
        function cancel_configure_account(){
            $("#configure_account").hide();
        }

    function configure_account(code,flag) {
        $("#configure_account").show();
        $.ajax({
                url: '/manualConfigureAccount',
                async:false,
                type:"POST",
                data: JSON.stringify({"code":code,"risk_type":riskDataType}),
                success:function(result){
                    if ($.type(result)=="string"){
                        result = JSON.parse(result);
                    }
                    var manualConfigureList = result.manual_configure_list;
                    var marketValueSum = result.market_value_sum;
                    if (configureAccountDataTable != null){
                        configureAccountDataTable.destroy();
                    }
                    if (flag){
                        configureAccountDataTable=$('#configureAccountDataTable').DataTable({
                        "searching":true,
                        "ordering": false,
                        "info":     false,
                        "paging": false,
                        "data": manualConfigureList,
                        "lengthChange": false,
                        "columns": [
                            {"data":"user_name"},
                            { "data": "account_id" },
                            { "data": "user_type" },
                            {"data":"strategy_name"},
                            {"data":"code"},
                            {"data":"sell_vol"},
                            {"data":"manual_sell_vol"},
                            {'data':"market_value"},
                            {"data":""}
                        ],
                        "columnDefs": [
                            {
                                "targets": -1,
                                "render": function ( data, type, full, meta ) {
                                    var code = full["code"];
                                    var strategy = full["strategy"];
                                    var account_id = full["account_id"];
                                    var sell_vol = full["sell_vol"];
                                    var cell = '<button class="button" type="text" onclick="update_manual_sell_vol(\'all\',\''+ code + '\',\''+
                                        strategy + '\',\''+ account_id +'\',\''+sell_vol+'\')" >全部</button>&nbsp&nbsp&nbsp';
                                    cell += '<button class="button" type="text" onclick="update_manual_sell_vol(\'half\',\''+ code + '\',\''+
                                        strategy + '\',\''+ account_id +'\',\''+sell_vol+'\')" >一半</button>&nbsp&nbsp&nbsp';
                                    cell += '<button class="button" type="text" onclick="update_manual_sell_vol(\'zero\',\''+ code + '\',\''+
                                        strategy + '\',\''+ account_id +'\',\''+sell_vol+'\')" >不卖</button>';
                                    return cell;
                                }
                            }
                        ]});
                    }else{
                        configureAccountDataTable=$('#configureAccountDataTable').DataTable({
                        "searching":true,
                        "ordering": false,
                        "info":     false,
                        "paging": false,
                        "data": manualConfigureList,
                        "lengthChange": false,
                        "columns": [
                            {"data":"user_name"},
                            {"data":"account_id" },
                            {"data":"user_type" },
                            {"data":"strategy_name"},
                            {"data":"code"},
                            {"data":"sell_vol"},
                            {"data":"manual_sell_vol"},
                            {"data":"market_value"},
                            {"data":""}
                        ],
                        "columnDefs": [
                            {
                                "targets": -1,
                                "render": function ( data, type, full, meta ) {
                                    return "不支持修改";
                                }
                            }
                        ]
                        });
                        }
                    $("#market_value_sum").text("市值总和:"+String(marketValueSum)+"万");
                    selectSource($("#source-button").text());
            }
        });

        }

        function buyOff(){
            myConfirm('系统确认框','您确定要关闭总开关吗 !!',function(r){
                if(r){
                    //...点确定之后执行的内容
                    $.ajax({
                        url: '/buyOff',
                        async:true,
                        success:function(result){
                            obj = JSON.parse(result);
                            if (obj.message){
                                alert(obj.message);
                        }
                    }
                });

                }
            });

    }

    function buyOpen(){

            myConfirm('系统确认框','您确定要开启总开关吗 !!',function(r){
            if(r){
                //...点确定之后执行的内容
                $.ajax({
                    url: '/buyOn',
                    async:true,
                    success:function(result){
                        obj = JSON.parse(result);
                        if (obj.message){
                            alert(obj.message);
                    }
                }
            });

            }
        });

    }

    var dataTableAccount = null;
    var dataTableBuySell = null;
    var dataTableClientInfo = null;
    // 初始化选择适配器    低风险
    var dataType = "adapter";
    var riskDataType = "risk-low";
    var all_info_list_account_info;
    var all_info_list_entrust_info;
    var risk_low_sell_by_manual_stocks = [];
    var risk_high_sell_by_manual_stocks = [];
    var toBuyStocksDataTable = null;

    // load some data
    function doLoad(portfoli_list,flag) {

        if (flag=='account_info'){
            dataTableAccount.data(portfoli_list,'stock_code');
            }
        if (flag=='buy_sell_info'){
            dataTableBuySell.data(portfoli_list,'stock_code');
            }
        if (flag=='entrust_info'){
            dataTableEntrust.data(portfoli_list,'stock_code');
            }
        if (flag == 'capital_info'){
            dataTableCapital.data(portfoli_list,'stock_code');
        }
        if (flag == 'client_info'){
            dataTableClientInfo.data(portfoli_list,'stock_code');
        }
    }

    function getSellByManualStocks(){
        $.ajax({
            url:"/getSellByManual",
            async:true,
            success:function (result) {
                if (jQuery.type(result) == "string"){
                    var obj = JSON.parse(result);
                }else{
                    var obj= result;
                }
                risk_low_sell_by_manual_stocks = obj.risk_low_sell_by_manual_stocks;
                risk_high_sell_by_manual_stocks = obj.risk_high_sell_by_manual_stocks;
                var setColor="rgb(68,113,188)";
                $("#adapter").css("background-color",setColor);
                refreshAccountInfo();
                refreshEntrustInfo();
            }
        })
    }

    function refreshAccountInfo(){
        if (riskDataType == "risk-low"){
            var sellByManualStocks = risk_low_sell_by_manual_stocks;
        }else{
            var sellByManualStocks = risk_high_sell_by_manual_stocks;
        }
        $.ajax({
                url: '/accountInfoForManualOperation',
                async:true,
                type:"POST",
                data:JSON.stringify({"type":dataType,"riskDataType":riskDataType,"sellByManual":sellByManualStocks}),
                dataType:"json",
                success:function(result){
                    if ($.type(result) == "string"){
                        var obj = JOSN.parse(result);
                    }else{
                        var obj = result;
                    }
                    all_info_list_account_info = obj.all_info_list;
                    doLoad(all_info_list_account_info , 'account_info');
                }
            }
        );
}

function refreshToBuyStocks() {
            $.ajax({
                    url: '/refreshToBuyStocks',
                    async:false,
                    success:function(result){
                        if ($.type(result)=="string"){
                            result = JSON.parse(result);
                        }
                        var toBuyStock = result.toBuyStocks;
                        if (toBuyStocksDataTable != null){
                            toBuyStocksDataTable.destroy();
                        }
                        toBuyStocksDataTable=$('#toBuyStocksDataTable').DataTable({
                        "searching":false,
                        "ordering": false,
                        "info":     false,
                        "paging": false,
                        "data": toBuyStock,
                        "lengthChange": false,
                        "columns": [
                            {"data":"stock_code"},
                            { "data": "stock_name" },
                            { "data": "current_price" },
                            {"data":"position"},
                            {"data":""},
                            {"data":""},
                            {"data":""},
                            {"data":""}
                        ],
                        "columnDefs": [
                            {
                                "targets": 4,
                                "render": function ( data, type, full, meta ) {
                                    var stock_code = full["stock_code"];
                                    var stock_name = full["stock_name"];

                                    var cell =
                                    '<label>' +
                                    '<input type="radio" name="'+stock_code+'radio'+'" id="'+stock_code+'_radio1'+ '" value="option1">1/3仓位' +
                                    '</label>' +
                                    '<label>' +
                                    '<input type="radio" name="'+stock_code+'radio'+'" id="'+stock_code+'_radio2'+ '" value="option2">1/2仓位' +
                                    '</label>' +
                                    '<label>' +
                                    '<input type="radio" name="'+stock_code+'radio'+'" id="'+stock_code+'_radio3'+ '" value="option3">全仓' +
                                    '</label>' ;
                                    return cell;
                                }
                            },
                            {
                                "targets": 5,
                                "render": function ( data, type, full, meta ) {
                                    var stock_code = full["stock_code"];
                                    var stock_name = full["stock_name"];
                                    var cell = '<button class="button" type="text" onclick="market_price_buy(\''+ stock_code+'\',\''+stock_name + '\')" >市价买入</button>&nbsp&nbsp&nbsp';
                                    return cell;
                                }
                            },
                            {
                                "targets": 6,
                                "render": function (data, type, full, meta ) {
                                    var stock_code = full["stock_code"];
                                    var stock_name = full["stock_name"];
                                    var stock_code_id = full["stock_code"]+"_buy";
                                    var cell = '<input type="text" id="'+ stock_code_id + '" value="" >&nbsp&nbsp&nbsp';
                                    cell += '<button class="button" type="text" onclick="limit_price_buy(\''+ stock_code+'\',\''+ stock_name  + '\')">限价买入</button>&nbsp&nbsp&nbsp';
                                    return cell;
                                }
                            },
                            {
                                "targets": 7,
                                "render": function ( data, type, full, meta ) {
                                    var stock_code = full["stock_code"];
                                    var cell = '<button class="button" type="text" onclick="del_code(\''+ stock_code + '\')" >删除</button>&nbsp&nbsp&nbsp';
                                    return cell;
                                }
                            }
                        ]});
                }
            });
}
function refreshEntrustInfo(){
    var all_sell_by_manual_stocks = risk_low_sell_by_manual_stocks.concat(risk_high_sell_by_manual_stocks);
        $.ajax({
            url: '/entrustInfoForManualOperation',
            async:true,
            type:"POST",
            data:JSON.stringify({"sellByManual":all_sell_by_manual_stocks}),
            dataType:"json",
            success:function(result){
                if ($.type(result) == "string"){
                    var obj = JSON.parse(result);
                }else{
                    var obj = result;
                }
                all_info_list_entrust_info = obj.all_info_list;
                doLoad(all_info_list_entrust_info,'entrust_info');
            }
        }
    );
}

function refreshClientInfo(){
    var date = $("#client_date").val();
    var account_id = $("#client_account_id").val();
    var profitLoss = $("#client_profit_loss").val();
    $.ajax({
            url: '/clientInfo',
            async:true,
            type:'POST',
			data:JSON.stringify({'date':date,
                                'account_id':account_id,
                                'profit_loss':profitLoss
			                    }),
			dataType:'json',
            success:function(result){
                var obj = result;
                var client_info = obj.client_info;
                doLoad(client_info,'client_info');
            }
        }
    );
}

function loadClienInfo(){

        $.getJSON("/json",function (data) {
            var tradeDayList=data.trade_day;
            var start_day = "2018-08-01";
            for (var i=0;i<tradeDayList.length;i++){
                var date=tradeDayList[i];
                if (date < start_day){
                    continue;
                }

                var html_str = "<option value='" + date + "'>" + date + "</option>";

                $('#client_date').append(html_str);
            }
        });
        $.getJSON("/accountJson",function (data) {
            var accountList=data.account_list;
            var userNameList= data.user_name_list;
            for (var i=0;i<accountList.length;i++){
                var account = accountList[i];

                var accountName = userNameList[i];

                var html_str = "<option value='" + account + "'>" + accountName + "</option>";

                $('#client_account_id').append(html_str);
                refreshClientInfo();
            }
        });
    }

    function changeDisplay(type){
        $("#adapter").css("background-color","white");
        $("#db").css("background-color","white");
        var setColor="rgb(68,113,188)";
        $("#"+type).css("background-color",setColor);
        dataType = type;
        refreshAccountInfo();
        }
function changeRiskDisplay(type){
        $("#risk-high").css("background-color","white");
        $("#risk-low").css("background-color","white");
        var setColor="rgb(68,113,188)";
        $("#"+type).css("background-color",setColor);
        riskDataType = type;
        refreshAccountInfo();

}
jQuery(document).ready(function () {
    loadClienInfo();
    $("#client_date").change(function () {
       refreshClientInfo();
    });
    $("#client_account_id").change(function () {
       refreshClientInfo();
    });
    $("#client_profit_loss").change(function () {
       refreshClientInfo();
    });

     dataTableAccount = jQuery("#dataTable").raytable({
        datasource: { data: [], keyfield: 'stock_code' },
        columns: [
        {field:"button",title:"卖出策略"},
        { field: "stock_code", title: "证券代码"},
        { field: "name", title: "证券名称"},
        { field: "buyTime", title: "最近买入时间"},
        { field: "buyPrice", title: "买入价"},
        {#{ field: "amount", title: "最新市值"},#}
        { field: "volume", title: "股票余额"},
        { field: "vol_sellable", title: "可卖数量"},
        {#{ field: "buy_price", title: "买入均价"},#}
        { field: "current_price", title: "当前价"},
        { field: "markt_price_sell_btn", title: "市价卖出"},
        { field: "input_price", title: "限价卖出"},
        {field:"limit_price_sell_btn",title:"按钮"},
        {field:"configuration",title:"配置账户"},
        {field:"stock_hold",title:"持仓账户"}
        ],
        pagesize: 100,
        maxPageButtons: 5,
        rowNumbers: true
    });

     dataTableEntrust = jQuery("#entrustDataTable").raytable_new_new({
        datasource: { data: [], keyfield: 'stock_code' },
        columns: [
        { field: "code", title: "证券代码"},
        { field: "name", title: "证券名称"},
        { field: "time", title: "委托时间"},
        { field: "priceOrder", title: "委托价格"},
        { field: "volOrder", title: "委托数量"},
        { field: "volCancel", title: "撤单数量"},
        { field: "volTransaction", title: "成交数量"},
        { field: "buySellMark", title: "买卖标志"},
        { field: "cancelOrder", title: "撤单"}
        {#{ title: "人工撤单", icons: [{ glyph: "glyphicon-remove", handler: cancelOrder, data: "stock_code" }#}
        {#] }#}

        ],
        pagesize: 100,
        maxPageButtons: 5,
        rowNumbers: true

    });

     dataTableClientInfo = jQuery("#clientInfoDataTable").raytable_new({
        datasource: { data: [], keyfield: 'stock_code' },
        columns: [
        {field:"account_id",title:"账户名称"},
        {field:"strategy",title:"所选策略"},
        { field: "code", title: "证券代码"},
        { field: "name", title: "证券名称"},
        {#{ field: "remainVol", title: "股票余额"},#}
        { field: "buyTime", title: "买入时间"},
        { field: "sellTime", title: "卖出时间"},
        { field: "buyPrice", title: "买入均价"},
        { field: "sellPrice", title: "卖出均价"},
        { field: "profit", title: "收益"}
        ],
        pagesize: 100,
        maxPageButtons: 5,
        rowNumbers: true

    });

    getSellByManualStocks();

refreshToBuyStocks();
setInterval(function(){
        var refreshAccount = true;
        jQuery('.input_price').each(function(key,value){
             if($(this).val() != ''){
                 refreshAccount = false;
             }
        });
        if (refreshAccount){
            refreshAccountInfo();
        }
        refreshEntrustInfo();
    },10000);
    });
changeRiskDisplay("risk-low");
</script>
</body>
</html>

